package xerr

var message map[uint32]string

func init() {
	message = make(map[uint32]string)
	message[OK] = "SUCCESS"
	message[ServerCommonError] = "server not available"
	message[RequestParamError] = "param error"
	message[TokenExpireError] = "token expire"
	message[TokenGenerateError] = "get token error"
	message[DbError] = "system error"
	message[DbUpdateAffectedZeroError] = "update affected zero"
	message[UserNotExist] = "user not exist"
}

func MapErrMsg(errcode uint32) string {
	if msg, ok := message[errcode]; ok {
		return msg
	} else {
		return ""
	}
}

func IsCodeErr(errcode uint32) bool {
	if _, ok := message[errcode]; ok {
		return true
	} else {
		return false
	}
}
